package junior.db.dao.mybatis.base;

import junior.db.dao.base.IBaseId;
import junior.db.dao.update.BatchUpdateOption;
import junior.db.dao.update.UpdateFieldOption;
import junior.db.dao.update.UpdateMapperProvider;
import junior.db.dao.update.UpdateOption;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.UpdateProvider;

import java.util.List;

/**
 * @author wubo
 * @date 2024/8/28 15:37
 */
public interface BaseUpdateMapper<E extends IBaseId> extends IBaseMapper<E> {
    
    @UpdateProvider(type = UpdateMapperProvider.class, method = "update")
    int update(@Param("entity") E entity, @Param("option") UpdateOption option);
    
    @UpdateProvider(type = UpdateMapperProvider.class, method = "batchUpdate")
    int batchUpdate(@Param("entities") List<E> entities, @Param("option") BatchUpdateOption option);
    
    @UpdateProvider(type = UpdateMapperProvider.class, method = "updateField")
    int updateField(UpdateFieldOption option);
}
